/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ibrae.mchs.radiation.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author murr
 */
@Entity
@Table(name = "dic_time", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"ID_TIME"})})
@NamedQueries({
    @NamedQuery(name = "DicTime.findAll", query = "SELECT d FROM DicTime d"),
    @NamedQuery(name = "DicTime.findByIdTime", query = "SELECT d FROM DicTime d WHERE d.idTime = :idTime"),
    @NamedQuery(name = "DicTime.findByT0", query = "SELECT d FROM DicTime d WHERE d.t0 = :t0"),
    @NamedQuery(name = "DicTime.findByTN", query = "SELECT d FROM DicTime d WHERE d.tN = :tN"),
    @NamedQuery(name = "DicTime.findByFlagNas", query = "SELECT d FROM DicTime d WHERE d.flagNas = :flagNas")})
public class DicTime implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_TIME", nullable = false)
    private Integer idTime;
    @Column(name = "T_0")
    @Temporal(TemporalType.TIMESTAMP)
    private Date t0;
    @Basic(optional = false)
    @Column(name = "T_N", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date tN;
    @Basic(optional = false)
    @Column(name = "FLAG_NAS", nullable = false)
    private boolean flagNas;
    @OneToMany(mappedBy = "dicTime")
    private Set<Result> resultSet;

    public DicTime() {
    }

    public DicTime(Integer idTime) {
        this.idTime = idTime;
    }

    public DicTime(Integer idTime, Date tN, boolean flagNas) {
        this.idTime = idTime;
        this.tN = tN;
        this.flagNas = flagNas;
    }

    public Integer getIdTime() {
        return idTime;
    }

    public void setIdTime(Integer idTime) {
        this.idTime = idTime;
    }

    public Date getT0() {
        return t0;
    }

    public void setT0(Date t0) {
        this.t0 = t0;
    }

    public Date getTN() {
        return tN;
    }

    public void setTN(Date tN) {
        this.tN = tN;
    }

    public boolean getFlagNas() {
        return flagNas;
    }

    public void setFlagNas(boolean flagNas) {
        this.flagNas = flagNas;
    }

    public Set<Result> getResultSet() {
        return resultSet;
    }

    public void setResultSet(Set<Result> resultSet) {
        this.resultSet = resultSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTime != null ? idTime.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DicTime)) {
            return false;
        }
        DicTime other = (DicTime) object;
        if ((this.idTime == null && other.idTime != null) || (this.idTime != null && !this.idTime.equals(other.idTime))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "JPAtest.entities.DicTime[idTime=" + idTime + "]";
    }

}
